#include "TextureUpdater.h"

CTextureUpdater::CTextureUpdater()
{

}

CTextureUpdater::~CTextureUpdater()
{

}

void CTextureUpdater::UpdateTexture(QImage& img)
{
	m_mutex.lock();
	m_hasData = true;
	m_image = std::move(img);
	m_mutex.unlock();
}

void CTextureUpdater::run()
{
	while (true)
	{
		m_mutex.lock();
		QThread::msleep(10);
		if (m_hasData)
		{
			emit SigSendQImage(m_image);
		}
		m_hasData = false;
		m_mutex.unlock();
	}
}